public class demo47 {
    private static int total=0;
    public static void main(String[] args) throws InterruptedException {
        Runnable runnable=new Runnable() {
            @Override
            public void run() {
                int sum=0;
                for(int i=1;i<=100;i++){
                    sum+=i;
                }
                total=sum;
            }
        };
        Thread t=new Thread(runnable);
        t.start();
        t.join();
        System.out.println("total="+total );
    }
}
